<template>
  <div>
    <input type="text" @input="zkss" @blur="cancel" />
  </div>
</template>

<script>
import debounce from "./utils.js";
import _ from "lodash";
export default {
  data() {
    return {
      data: "",
      zks() {
        console.log(33);
      },
    };
  },

  //   vue的methods方法是通过bind方法映射的     ===methods.zkks.bind(this实例) 所以我们可以直接使用this.zkss
  methods: {
    zkss: _.debounce(
      function () {
        // console.log(this);
        this.zks();
      },
      100,
      {
        leading: true,
        trailing: false,
      }
    ),

    cancel: _.debounce(
      function () {
        // console.log(this);
        this.zks();
      },
      100,
      {
        leading: true,
        trailing: false,
      }
    ).cancel,
  },
};
</script>
